<template>
	<div class="flex-col mb-20" @click="toDetail(item.data.id,item.data)">
		<div class="between shadow overflow-hidden rounded-16">
			<div class=" text-center center text-white fz24 pt-24 pb-24 w-40"
				:class="{'bg-green':item.data.status==1,'bg-yellow':item.data.status==2,'bg-orange':item.data.status==3,'bg-red':item.data.status==4}"
				style="align-self: stretch;">
				车位{{statusText[item.data.status]}}
			</div>
			<div class="rounded-full w-100 h-100 flex-shirnk-0 bg-green center overflow-hidden ml-20 mr-20">
				<image :src="item.data.pic" class="w-full h-full" mode="aspectFill"></image>
			</div>
			<div class="info fz24 text-gray-900 pr-50" style="width: 100%;">
				<div class="fz28 text-black">
					{{item.data.name}}
				</div>
				<div class="between mt-10">
					<div class="">编号:{{item.data.sn}}</div>
				</div>
				<div class="between mt-5">
					<div class="">
						<text decode="decode">营业时间:{{ item.data.start_time }}-{{ item.data.end_time }} <block v-if="item.data.start_time2"> |{{ item.data.start_time2 }}-{{ item.data.end_time2 }} </block><block v-if="item.data.start_time3">|{{ item.data.start_time3 }}-{{ item.data.end_time3 }} </block></text>
					</div>
				</div>
				<div class="between">
					<div class="">停车费:{{item.data.price}}元/小时</div>
					<div class="text-green-2" style="display: none;">可约停车位</div>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		props: ["item","type"],
		data() {
			return {
				statusText: {
					1: "正常",
					2: "故障",
					3: "被占用 ",
					4: "停用",
				}
			}
		},
		methods: {
			toDetail(id,data) {
				if(uni.getStorageSync("id")==''){
					this.toast('请先登录')
					
					setTimeout(function(){
						uni.redirectTo({
							url:'/pages/start/splash'
						})
					},2000)
				}else{
					if(this.type!=1){
						if(data.flag==1){
							uni.navigateTo({
								url: `/pages/detail/pileDetail?id=${id}&lot=1`
							})
						}else{
							this.toast('还没到营业时间哦!')
						}
					}
				}
			}
		}
	}
</script>

<style>
</style>